<?php
class fieldtype_linked extends fieldtype {
	
	function getLinkedValue($id) {
		if ($id) {
			$sql = "SELECT ".$this->link_show." FROM ".$this->link_table." WHERE id = ".$id;
			return db::getInstance()->select_one($sql);
		} else {
			return "";
		}
	}
	
	function getLinkedList() {
		$db = db::getInstance();
		$sql = "SELECT id, ".$this->link_show." AS display FROM ".$this->link_table;
		$db->select($sql);
		return $db->get_obj();
	}
	
}
?>